package com.h3c.web.common;

/**
 * @ClassName: BaseResponse
 * @Description: 响应对象
 * @author: d14287
 * @date: 2017年6月2日 下午4:57:05
 */
public class BaseResponse {
	public Boolean isSuccess = true;
	public String errMsg;
	public Object data;

	public Boolean getIsSuccess() {
		return isSuccess;
	}

	public void setIsSuccess(Boolean isSuccess) {
		this.isSuccess = isSuccess;
	}

	public String getErrMsg() {
		return errMsg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	/**
	 * 处理成功，response带响应数据
	 * 
	 * @param data
	 * @return
	 */
	public static BaseResponse trueOf(Object data) {
		BaseResponse response = new BaseResponse();
		response.setIsSuccess(Boolean.TRUE);
		response.setData(data);
		return response;
	}

	/**
	 * 处理成功，不带响应数据
	 * 
	 * @return
	 */
	public static BaseResponse trueOf() {
		BaseResponse response = new BaseResponse();
		response.setIsSuccess(Boolean.TRUE);
		return response;
	}

	/**
	 * 处理失败，返回失败信息
	 * 
	 * @param errMsg
	 * @return
	 */
	public static BaseResponse falseOf(String errMsg) {
		BaseResponse response = new BaseResponse();
		response.setIsSuccess(Boolean.FALSE);
		response.setErrMsg(errMsg);
		return response;
	}

}
